﻿#pragma once
#include "Matrix.h"
#include<iostream>
using namespace std;

class Matrix;
class Transform;

class Vector {
public:
	double x, y, z, w;
	Vector() {}
	Vector(double x_, double y_, double z_, double w_ = 1.f)
		: x(x_), y(y_), z(z_), w(w_){}
	//基础运算
	bool operator ==(const Vector &a) const ;
	bool operator !=(const Vector &a) const ;
	Vector &operator =(const Vector &a) ;
	Vector operator -(const Vector &a) const ;
	Vector operator +(const Vector &a) const ;
	Vector operator *(double a) const ;
	Vector operator /(double a) const ;
	void normalize() ;
	double operator *(const Vector &a) const ;
	Vector operator *(const Matrix &m) const ;
	Vector operator -() ;
	//变换
	void homogenize();//规范化设备坐标系->屏幕
};
double getVectorMag(const Vector &a) ;
Vector getCrossProduct(const Vector &a, const Vector &b) ;
double getDistance(const Vector &a, const Vector &b) ;
ostream& operator << (ostream &out, const Vector &v) ;
bool checkCvv(Vector v);
Vector getDot(const Vector &a, const Vector &b);